package com.southpark.demo.control.commands.navigation
{
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.southpark.demo.control.events.navigation.AddPopUpEvent;
	import com.southpark.demo.control.responders.BaseResponder;
	import com.southpark.system.interfaces.view.IViewController;


	public class AddPopUpCommand extends BaseResponder
	{
		override public function execute(cairngormEvent:CairngormEvent):void
		{
			super.execute(cairngormEvent);
			var event:AddPopUpEvent = cairngormEvent as AddPopUpEvent;
			var viewController:IViewController = applicationManager.popUpManager.addPopUp(event.popUpInterface,event.killOtherPopUps,event.isModal,event.isRegistered);
			
			if (!viewController) 
			{
				super.onFault(null);
				return;
			};
			
			super.onSuccess(viewController);
		}
		
	}
}